package com.pvj.myaccount.repository

import com.pvj.myaccount.room.DbHelper
import com.pvj.myaccount.room.entity.Cost
import com.pvj.myaccount.room.entity.MonthCost

class HomeRepository {

    suspend fun getData(start: Long, end: Long): List<Cost>? {
        // 异步获取数据
        return DbHelper.INSTANCE?.costDao()?.findCostsTime(start, end)
    }

    fun insert(data: Cost)  {
        // 异步获取数据
        DbHelper.INSTANCE?.costDao()?.insert(data)
    }

    fun delete(data: Cost)  {
        // 异步获取数据
        DbHelper.INSTANCE?.costDao()?.delete(data)
    }

    fun update(data: Cost)  {
        // 异步获取数据
        DbHelper.INSTANCE?.costDao()?.update(data)
    }
}